/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * A simple items list view
 * Its a DataGrid of items that shows the following information:
 *  - A small picture
 *  - Item SKU
 *  - Item discription (3 lines Max ?! or maybe more)
 *  - Price
 */

dojo.provide("afitco.eTajer.widgets.ItemsList");
dojo.require("dojox.grid.DataGrid");
dojo.require("dojo.data.ItemFileReadStore");

dojo.declare("afitco.eTajer.widgets.ItemsList",
    /* Extends */ [dojox.grid.DataGrid],
    {
        url: "",
        postMixInProperties: function()
        {
            this.inherited(arguments);
            this.autoHeight = true;
            this.store = new dojo.data.ItemFileReadStore({
                url: this.url
            })
            this.structure = [
            {
                field: "imageSrc",
                name:" ",
                width: "200px",
                formatter: function(image)
                {
                    return "<img align='center' src='" + image + "'/>"
                }
            },
            {
                field: "SKU",
                name: "SKU",
                width: "50px"
            },
            {
                field: "Description",
                name: "Description",
                width: "300px"
            },
            {
                field: "Price",
                name: "Price",
                width: "50px",
                formatter: function(item){
                    return "<b>" + item + '</b>';
                }

            }];

            this.query = {
                SKU: '*'
            };
            

        }
    });

